﻿@inherits umbraco.MacroEngines.DynamicNodeContext

<nav>
	<ul id="menu">
	@{ var homeNode = Model.AncestorOrSelf("Homepage"); }
	@if("Homepage".Equals(Model.Content.Name))
	{
		<li class="active"><a href="@homeNode.Url"><span>@homeNode.Name</span></a></li>
	}
	else
	{
		<li class="active"><a href="@homeNode.Url"><span>@homeNode.Name</span></a></li>
	}

	@foreach (var page in homeNode.Children.Where("Visible"))
	{
		if ("Contacts".Equals(page.Name))
		{
			if(page.Name.Equals(Model.Name))
			{
				<li class="last active"><a href="@page.Url"><span>@page.Name</span></a></li>
			}
			else
			{
				<li class="last"><a href="@page.Url"><span>@page.Name</span></a></li>
			}
		}
		else
		{
			if(page.Name.Equals(Model.Name))
			{
				<li class="active"><a href="@page.Url"><span>@page.Name</span></a></li> 
			}
			else
			{
				<li><a href="@page.Url"><span>@page.Name</span></a></li> 
			}
		}
	}
	</ul>
</nav> 